// 项目的入口文件
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import './plugins/element.js'
// 导入全局样式表
import './assets/librarian/css/global.css'
import './assets/admin/css/global.css'
// 导入字体图标
import './assets/admin/fonts/iconfont.css'



import axios from 'axios'
import qs from 'qs'
import './plugins/axios'



// 设置请求根路径
axios.defaults.baseURL = 'https://118.178.190.4'
    // response
axios.interceptors.response.use(function(response) {
        //获取响应数据
        const data = response.data
            //如果error数据小于0，证明请求异常
        if (data.errorCode <= -1) {
            //抛出异常
            const err = new Error(data.message)
            throw err;
        } else {
            return response;
        }
    },
    function(error) {
        // Do something with response error
        return Promise.reject(error);
    });


// 全局挂载
Vue.prototype.$http = axios
Vue.prototype.qs = qs
Vue.config.productionTip = false
axios.defaults.withCredentials = true


new Vue({
    router,
    el: '#app',
    render: h => h(App)
}).$mount('#app')